<!-- include ajax form updater -->
<script language="JavaScript" type="text/javascript">
    window.enable_order_position = {$INA.enable_order_position|default:0};
</script>
<script language="JavaScript" type="text/javascript" src="{$INA.adminTemplate}javascript/formUpdater.js"></script>
<!-- end include ajax form updater -->

<!-- Left Rail -->
{if !$smarty.get.action and !$smarty.get.id}
    <div id="nodeTree">
		<div align="center" style="padding: 30px;"><img src="{$INA.adminTemplate}images/loading.gif" alt="Loading..." /></div>
	</div>
    
    <script language="JavaScript" type="text/javascript">loadSiteTree({$smarty.cookies.probableParent});</script>
{else}
    <script language="JavaScript" type="text/javascript" src="{$INA.adminTemplate}javascript/contentEditing.js"></script>
    {include file=tinymceinit.html}
    
    <div id="nodeTree">
        <div id="ssBevel">
            <table id="ssTable" cellpadding="0" cellspacing="0">
                <thead>
                    <!-- control menu -->
            	    <tr>
            	       <td id="ssMenu" colspan="2">   
            		       <table cellpadding="0" cellspacing="0"><tr><td width="100%">
            		       
            	               <a href="javascript: loadSiteTree();">
                	               <img src="{$INA.adminTemplate}images/home.gif" alt="Home" height="24" width="24" border="0" align="absmiddle" />
                	           </a>
            	           
            			   </td>
            
            			   <td><div class="loading" id="loadingIC1" style="display: none;">&nbsp;</div></td>
            			   <tr></table>
            	       </td>
            	    </tr>
            	    <!-- end control menu -->
                </thead>
                
                <tbody>
            	   <!-- path to the node -->
                    <tr>
                        <td class="sitePath" colspan="2">
                            <table cellpadding="0" cellspacing="0" width="100%">
                                <tr><td style="padding-right: 6px;">Location:</td>
                                <td id="location">
                                    {foreach from=$sitePath item=path name=sitePath}
                                        {if $smarty.foreach.sitePath.last and !$smarty.foreach.sitePath.first}
                                            {$path.title}
                                        {elseif $smarty.foreach.sitePath.first and $smarty.foreach.sitePath.last}
                                            <a href="javascript: loadSiteTree({$path.id});">{$path.title}</a>
                                        {else}
                                            <a href="javascript: loadSiteTree({$path.id});">{$path.title}</a> /
                                        {/if}
                                    {/foreach}
                                </td><td>&nbsp;</td></tr>
                            </table>
                        </td>
                    </tr>
                    <!-- end path to the node -->
            	   <tr>
            	       <td id="ssInfo" valign="top">
                           <div id="nodeInfo">
                                <!-- Properties Start -->
                                <h3>
                                    {if !$smarty.cookies.close_props or $smarty.cookies.close_props == '0'}
                                        <div id="props" class="closeGroup" onclick="closeDialog('props');">Properties</div>
                                        <div id="props_alt" class="openGroup" onclick="openDialog('props');" style="display: none;">Properties</div>
                                    {else}
                                        <div id="props" class="closeGroup" onclick="closeDialog('props');" style="display: none;">Properties</div>
                                        <div id="props_alt" class="openGroup" onclick="openDialog('props');">Properties</div>
                                    {/if}
                                </h3>
                                
                                <div class="infoBox" id="props_data" {if $smarty.cookies.close_props}style="display: none;"{/if}>
                                    <table class="sidetable" id="available_properties">
                                        <tbody>
                                            {foreach from=$properties item=prop}
                                                <tr id="proprow_{$prop.name}">
                                                    <td class="name" id="proptag_{$prop.name}">{$prop.name}:</td>
                                                    <td class="value" id="propvalue_{$prop.name}">{$prop.value} {if $prop.local}[<a href="javascript: deleteProperty('{$prop.id}','{$smarty.get.node}','{$smarty.get.id}','{$prop.name}');" class="admin">x</a>]{else}(inherited){/if}</td>
                                                </tr>
                                            {foreachelse}
                                                <tr id="noprops">
                                                    <td align="center" colspan="2"><i>No Properties</i></td>
                                                </tr>
                                            {/foreach}
                                        </tbody>
                                    </table>
                                	
                                	
                                    <div id="addprop" class="addnew"><a id="addpropbtn" href="#" onclick="hide('addprop'); unhide('addpropform',true); document.getElementById('newpropname').focus(); return false;">Add Property</a></div>
                                    
                                    <div id="addpropform" class="addnew_left" style="display: none;">
                                        <fieldset>
                                            <legend>Add New Property</legend>
                                            <label for="newpropname">Name:</label>
                                            <input type="text" id="newpropname" name="newpropname" class="textInput textInputSide" />
                                            <label for="newpropvalue">Value:</label>
                                            <input type="text" id="newpropvalue" name="newpropvalue" class="textInput textInputSide" />
                                            <input type="button" name="addprop" id="addprop" value="Add" class="submitInput" onclick="addProperty('{$smarty.get.node}','{$smarty.get.id}');" /> <a class="admin" href="#" onclick="unhide('addprop',true); return hide('addpropform',true); ">Cancel</a>
                                        </fieldset>
                                    </div>
                                </div>
                                <!-- Properties End -->
                                
                                {if $INA.vstamp <= 8}
                                <!-- Files Start -->
                                <h3>
                                    {if !$smarty.cookies.close_files or $smarty.cookies.close_files == '0'}
                                        <div id="files" class="closeGroup" onclick="closeDialog('files');">Files</div>
                                        <div id="files_alt" class="openGroup" onclick="openDialog('files');" style="display: none;">Files</div>
                                    {else}
                                        <div id="files" class="closeGroup" onclick="closeDialog('files');" style="display: none;">Files</div>
                                        <div id="files_alt" class="openGroup" onclick="openDialog('files');">Files</div>
                                    {/if}
                                </h3>
                                
                                <div class="infoBox" id="files_data" {if $smarty.cookies.close_files}style="display: none;"{/if}>
                                	<table class="sidetable" id="available_files">
                                        <tbody>
                                            {foreach from=$files item=file}
                                                <tr id="filerow_{$file.id}">
                                                    <td class="value"><a href="../files/{if $smarty.get.id}pages/{$smarty.get.id}{else}nodes/{$smarty.get.node}{/if}/{$file.name}">{$file.name}</a> <span class="filesize">({$file.size})</span> [<a href="javascript: deleteFile('{$file.name}','{$file.id}','{$smarty.get.node}','{$smarty.get.id}');" class="admin">x</a>]</td>
                                                </tr>
                                            {foreachelse}
                                                <tr id="nofiles">
                                                    <td align="center"><i>No Files</i></td>
                                                </tr>
                                            {/foreach}
                                        </tbody>
                                    </table>
                                	
                                    <div class="addnew" id="addfile"><a href="javascript:showUpload()" onclick="">Add File</a></div>
                                    
                                    <div id="addfileform" class="addnew_left" style="display: none;">
                                        <iframe name="uploader" frameborder="0" height="1" width="1"></iframe>
                                        <form target="uploader" style="margin:0; padding: 0;" action="{$INA.admin}sitestructure/?action=uploadFile&id={$smarty.get.id}&node={$smarty.get.node}" method="POST" enctype="multipart/form-data" onsubmit="showLoad();">
                                        <fieldset>
                                            <legend>Add New File</legend>
                                            <label for="newpropvalue">File Location:</label><br />
                                            <input type="file" id="fileloc" name="fileloc" class="textInput textInputSide fileInput" /><br />
                                            <input type="submit" name="addprop" id="addprop" value="Add" class="submitInput" /> <a class="admin" href="javascript:cancelUpload();" onclick="">Cancel</a>
                                        </fieldset>
                                        </form>
                                    </div>

                                </div>
                                <!-- Files End -->
                                {/if}
                                
                                
                                <!-- Data Blocks Start -->
                                <h3>
                                    {if !$smarty.cookies.close_blocks or $smarty.cookies.close_blocks == '0'}
                                        <div id="blocks" class="closeGroup" onclick="closeDialog('blocks');">Data Blocks</div>
                                        <div id="blocks_alt" class="openGroup" onclick="openDialog('blocks');" style="display: none;">Data Blocks</div>
                                    {else}
                                        <div id="blocks" class="closeGroup" onclick="closeDialog('blocks');" style="display: none;">Data Blocks</div>
                                        <div id="blocks_alt" class="openGroup" onclick="openDialog('blocks');">Data Blocks</div>
                                    {/if}
                                </h3>
                                
                                <div class="infoBox" id="blocks_data" {if $smarty.cookies.close_blocks}style="display: none;"{/if}>
                                	
                                	<table class="sidetable" id="available_data">
                                        <tbody>
                                            {foreach from=$myDatablocks item=data}
                                                <tr id="datarow_{$data.tag}">
                                                    <td id="datatitle_{$data.tag}" class="value">
                                                    {if $data.local}
                                                        <a href="javascript: editData('{$data.id}','{$smarty.get.node}','{$smarty.get.id}');" {popup text="Tag: `$data.tag`"}>{$data.title}</a> [<a href="javascript: deleteData('{$data.id}','{$smarty.get.node}','{$smarty.get.id}','{$data.tag}');" class="admin">x</a>]
                                                    {else}
                                                        <span {popup text="Tag: `$data.tag`"}>{$data.title} (inherited)</span>
                                                    {/if}
                                                    </td>
                                                </tr>
                                            {foreachelse}
                                                <tr id="nodata">
                                                    <td align="center"><i>No Datablocks</i></td>
                                                </tr>
                                            {/foreach}
                                        </tbody>
                                    </table>
                                	
                                    <div class="addnew" id="adddata">
                                    <a id="adddatabtn" href="#" onclick="hide('adddata'); unhide('adddataform',true); return false;">Add Datablock</a>
                                    </div>
                                    
                                    <div id="adddataform" class="addnew_left" style="display: none;">
                                        
                                        <fieldset>
                                            <legend>Add Data Block</legend>
                                            <select name="datablocks" id="datablocks" style="width: 100%; font-size: 9px;">
                                                <option value="new">New...</option>
                                                {foreach from=$datablocks item=md}
                                                    <option value="{$md.id}" label="{$md.title}">{$md.title}</option>
                                                {/foreach}
                                               
                                            </select><br />
                                            <input type="button" name="adddata" id="adddata" value="Add" class="submitInput" onclick="addDatablock('{$smarty.get.node}','{$smarty.get.id}');" /> <a class="admin" href="#" onclick="unhide('adddata',true); return hide('adddataform',true);">Cancel</a>
                                        </fieldset>
                                    </div>

                                </div>
                                <!-- Data Blocks End -->
                                
                                {if $smarty.get.id}
                                <!-- Tags Start -->
                                <h3>
                                    {if !$smarty.cookies.close_tags or $smarty.cookies.close_tags == '0'}
                                        <div id="tags" class="closeGroup" onclick="closeDialog('tags');">Tags</div>
                                        <div id="tags_alt" class="openGroup" onclick="openDialog('tags');" style="display: none;">Tags</div>
                                    {else}
                                        <div id="tags" class="closeGroup" onclick="closeDialog('tags');" style="display: none;">Tags</div>
                                        <div id="tags_alt" class="openGroup" onclick="openDialog('tags');">Tags</div>
                                    {/if}
                                </h3>
                                <div class="infoBox" id="tags_data" {if $smarty.cookies.close_tags}style="display: none;"{/if}>
                                	
                                	<table class="sidetable" id="available_tags">
                                        <tbody>
                                            {foreach from=$tags item=tag}
                                                <tr id="tagrow_{$tag.id}">
                                                    <td class="value">
                                                        {$tag.name} [<a href="javascript: deleteTag({$smarty.get.id},{$tag.id});" class="admin">x</a>]
                                                    </td>
                                                </tr>
                                            {foreachelse}
                                                <tr id="notags">
                                                    <td align="center"><i>No Tags</i></td>
                                                </tr>
                                            {/foreach}
                                        </tbody>
                                    </table>
                                	
                                    <div class="addnew" id="addtag">
                                    <a id="addtagbtn" href="#" onclick="hide('addtag'); unhide('addtagform',true); return false;">Add Tag</a>
                                    </div>
                                    
                                    <div id="addtagform" class="addnew_left" style="display: none;">
                                        
                                        <fieldset>
                                            <legend>Add Tag</legend>
                                            <select name="tags" id="myTags" style="width: 100%; font-size: 9px;" onchange="checkNewTag(this);">
                                                <option value="new">New...</option>
                                                {foreach from=$tags_new item=tag}
                                                    <option value="{$tag.id}" label="{$tag.name}">{$tag.name}</option>
                                                {/foreach}                                               
                                            </select><br />
                                            <div id="newTag">
                                                <label for="newtagname">Name:</label>
                                                <input type="text" id="newtagname" name="newtagname" class="textInput textInputSide" /><br />
                                            </div>
                                            <input type="button" name="addtag" id="addtag" value="Add" class="submitInput" onclick="addTag('{$smarty.get.id}');" /> <a class="admin" href="#" onclick="unhide('addtag',true); return hide('addtagform',true);">Cancel</a>
                                        </fieldset>
                                    </div>

                                </div>
                                <!-- Tags End -->
                                {/if}
                           </div>
            	       </td>
            	       <td valign="top" style="padding: 10px;">
            	            {if $smarty.get.confirm}
                                <div id="confirm">
                                    All data was successfully saved!
                                </div>
                            {/if}
            	           <form method="post" class="editform" action="{$INA.this}?action={$smarty.get.action}&node={$smarty.get.node}&id={$smarty.get.id}" onsubmit="disableButton('save')" enctype="multipart/form-data">
                                {include file=$subActionTemplate}
                                <div align="center"><input type="submit" name="save" value="Save Changes" id="save" class="button" /></div>
                           </form>
                       </td>
            	   </tr>
            	</tbody>
            </table>
        </div>
    </div>
{/if}
<!-- End Left Rail -->